package com.basics.user.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.basics.user.entity.CyUser;
import com.basics.user.mapper.CyUserMapper;
import com.basics.user.service.CyUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 用户表 服务实现类
 * </p>
 *
 * @author WangWei
 * @since 2025-03-09
 */
@Service
public class CyUserServiceImpl extends ServiceImpl<CyUserMapper, CyUser> implements CyUserService {

    @Override
    public CyUser getByUnionId(String unionId){
        return getOne(new QueryWrapper<CyUser>().eq("union_id",unionId));
    }

    @Override
    public CyUser getByOpenId(String openId){
        return getOne(new QueryWrapper<CyUser>().eq("open_id",openId));
    }

    @Override
    public CyUser getByPublicOpenId(String publicOpenId){
        return getOne(new QueryWrapper<CyUser>().eq("public_open_id",publicOpenId));
    }

    @Override
    public CyUser getByPhone(String phone){
        return getOne(new QueryWrapper<CyUser>().eq("phone",phone));
    }
}
